package poker;
import java.util.ArrayList;
import java.util.Random;
public class Deck {
	
	private ArrayList<Card> cards;
	private short size=0;
	public Deck() {
		cards = new ArrayList<Card>();
        for (short a=0; a<=3; a++){		//generowanie talii
            for (short b=0; b<=12; b++){
               cards.add(new Card(a,b));
            }
        }
        size=52;
	}
	public void shuffle(){				
        int index, index2;
        Card temp;
        Random randomizer = new Random();
        for (short i=0; i<50; i++){		//tasowanie x50
            index = randomizer.nextInt( size );
            index2 = randomizer.nextInt( size );

            temp = (Card) cards.get( index2 );
            cards.set( index2 , cards.get( index ) );
            cards.set( index, temp );
        }        	
	}

	public Card drawCard() {
		Card temp=cards.get(size);
		cards.remove(size);
		size--;
		return temp;
	}


}
